Class Translator

Summary

Fully Qualified Name: Laminas\I18n\Translator\Translator
Implements: TranslatorInterface

Description

Translator.

Methods

Name Description Defined By
addRemoteTranslations() Add remote translations. Translator
addTranslationFile() Add a translation file. Translator
addTranslationFilePattern() Add multiple translations with a file pattern. Translator
clearCache() Clears the cache for a specific textDomain and locale. Translator
disableEventManager() Disable the event manager. Translator
enableEventManager() Enable the event manager. Translator
factory() Instantiate a translator Translator
getAllMessages() Return all the messages. Translator
getCache() Returns the set cache Translator
getCacheId() Get the cache identifier for a specific textDomain and locale. Translator
getEventManager() Get the event manager. Translator
getFallbackLocale() Get the fallback locale. Translator
getLocale() Get the default locale. Translator
getPluginManager() Retrieve the plugin manager for translation loaders. Translator
isEventManagerEnabled() Check whether the event manager is enabled. Translator
setCache() Sets a cache Translator
setEventManager() Set the event manager instance used by this translator. Translator
setFallbackLocale() Set the fallback locale. Translator
setLocale() Set the default locale. Translator
setPluginManager() Set the plugin manager for translation loaders Translator
translate() Translate a message. Translator
translatePlural() Translate a plural message. Translator

Method Details

addRemoteTranslations()

Add remote translations.

Parameter Name Type Description
$type string
$textDomain string

Returns: $this

addTranslationFile()

Add a translation file.

Parameter Name Type Description
$type string
$filename string
$textDomain string
$locale string|null

Returns: $this

addTranslationFilePattern()

Add multiple translations with a file pattern.

Parameter Name Type Description
$type string
$baseDir string
$pattern string
$textDomain string

Returns: $this

clearCache()

Clears the cache for a specific textDomain and locale.

Parameter Name Type Description
$textDomain string
$locale string

Returns: bool

disableEventManager()

Disable the event manager.

Returns: $this

enableEventManager()

Enable the event manager.

Returns: $this

factory()

Instantiate a translator

Parameter Name Type Description
$options array|\Traversable

Returns: static

getAllMessages()

Return all the messages.

Parameter Name Type Description
$textDomain string
$locale string|null

Returns: mixed

getCache()

Returns the set cache

Returns: \CacheStorage|null The set cache

getCacheId()

Get the cache identifier for a specific textDomain and locale.

Parameter Name Type Description
$textDomain string
$locale string

Returns: string

getEventManager()

Get the event manager.

Returns: \EventManagerInterface

getFallbackLocale()

Get the fallback locale.

Returns: string|null

getLocale()

Get the default locale.

Returns: string

getPluginManager()

Retrieve the plugin manager for translation loaders.

Lazy loads an instance if none currently set.

Returns: \LoaderPluginManager

isEventManagerEnabled()

Check whether the event manager is enabled.

Returns: bool

setCache()

Sets a cache

Parameter Name Type Description
$cache \CacheStorage|null

Returns: $this

setEventManager()

Set the event manager instance used by this translator.

Parameter Name Type Description
$events \EventManagerInterface

Returns: $this

setFallbackLocale()

Set the fallback locale.

Parameter Name Type Description
$locale string|null

Returns: $this

setLocale()

Set the default locale.

Parameter Name Type Description
$locale string|null

Returns: $this

setPluginManager()

Set the plugin manager for translation loaders

Parameter Name Type Description
$pluginManager \LoaderPluginManager

Returns: $this

translate()

Translate a message.

Parameter Name Type Description
$message string
$textDomain string
$locale string|null

Returns: string

translatePlural()

Translate a plural message.

Parameter Name Type Description
$singular string
$plural string
$number int
$textDomain string
$locale string|null

Returns: string

Top